<div class="datatable">
  <rd-widget>
    <rd-widget-body classes="no-padding">
      <div class="toolBar">
        <div class="toolBarTitle"> <i class="fa" ng-class="$ctrl.titleIcon" aria-hidden="true" style="margin-right: 2px;"></i> {{ $ctrl.titleText }} </div>
      </div>

      <div class="actionBar" ng-if="$ctrl.showSnapshotAction">
        <button type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.snapshotAction()"> <i class="fa fa-sync space-right" aria-hidden="true"></i>Refresh </button>
      </div>

      <div class="searchBar">
        <i class="fa fa-search searchIcon" aria-hidden="true"></i>
        <input
          type="text"
          class="searchInput"
          ng-model="$ctrl.state.textFilter"
          ng-change="$ctrl.onTextFilterChange()"
          ng-model-options="{ debounce: 300 }"
          placeholder="Search by name, group, tag, status, URL..."
          auto-focus
        />
      </div>

      <div class="blocklist">
        <endpoint-item
          ng-if="$ctrl.hasBackendPagination()"
          dir-paginate="endpoint in $ctrl.state.filteredEndpoints | itemsPerPage: $ctrl.state.paginatedItemLimit"
          model="endpoint"
          total-items="$ctrl.state.totalFilteredEndpoints"
          on-select="($ctrl.dashboardAction)"
          on-edit="($ctrl.editAction)"
          is-admin="$ctrl.isAdmin"
          tags="$ctrl.tags"
        ></endpoint-item>
        <endpoint-item
          ng-if="!$ctrl.hasBackendPagination()"
          dir-paginate="endpoint in $ctrl.state.filteredEndpoints | itemsPerPage: $ctrl.state.paginatedItemLimit"
          model="endpoint"
          on-select="($ctrl.dashboardAction)"
          on-edit="($ctrl.editAction)"
          is-admin="$ctrl.isAdmin"
          tags="$ctrl.tags"
        ></endpoint-item>
        <div ng-if="$ctrl.state.loading" class="text-center text-muted">
          Loading...
        </div>
        <div ng-if="!$ctrl.state.loading && !$ctrl.state.filteredEndpoints.length" class="text-center text-muted">
          No endpoint available.
        </div>
      </div>

      <div class="footer" ng-if="$ctrl.endpoints">
        <div class="paginationControls">
          <form class="form-inline">
            <span class="limitSelector">
              <span style="margin-right: 5px;">
                Items per page
              </span>
              <select class="form-control" ng-model="$ctrl.state.paginatedItemLimit" ng-change="$ctrl.changePaginationLimit()">
                <option value="0" ng-if="!$ctrl.hasBackendPagination()">All</option>
                <option value="10">10</option>
                <option value="25">25</option>
                <option value="50">50</option>
                <option value="100">100</option>
              </select>
            </span>
            <dir-pagination-controls max-size="5" on-page-change="$ctrl.pageChangeHandler(newPageNumber, oldPageNumber)"></dir-pagination-controls>
          </form>
        </div>
      </div>
    </rd-widget-body>
  </rd-widget>
</div>
